<?php

class Application_Form_Registration extends Zend_Form
{

    public function init()
    {
        $this->setName('RegistartionForm');
        
        $id = new Zend_Form_Element_Hidden('hdn_id');
		$id->addFilter('Int');
		
		$username = new Zend_Form_Element_Text('txt_username');
		$username->setLabel('Username')
			 	 ->setRequired('true')
 			 	 ->addFilter('StripTags')
			 	 ->addFilter('StringTrim')
			 	 ->addValidator('NotEmpty');
		
		$password = new Zend_Form_Element_Password('txt_password');
		$password->setLabel('Password')
			 	 ->setRequired('true')
 			 	 ->addFilter('StripTags')
			 	 ->addFilter('StringTrim')
			 	 ->addValidator('StringLength', false, array(6));
		
		$password_confirm = new Zend_Form_Element_Password('txt_password_confirm');
		$password_confirm->setLabel('Password Confirmation')
			 			 ->setRequired('true')
 			 			 ->addFilter('StripTags')
						 ->addFilter('StringTrim')
						 ->addValidator('StringLength', false, array(6));
						 
		$email = new Zend_Form_Element_Text('txt_email');
		$email->setLabel('Email')
			  ->setRequired('true')
			  ->addValidator(new Zend_Validate_EmailAddress())
 			  ->addFilter('StripTags')
			  ->addFilter('StringTrim')
			  ->addValidator('NotEmpty');
		
		$type_user = new Zend_Form_Element_Select('cmb_type_user');
		$type_user->setRequired('true')
				  ->setLabel("Type User")
			 	  ->addMultiOption('1', 'Doktor')
		       	  ->addMultiOption('2', 'Pacient');

		//Add Captcha
		$captchaElement = new Zend_Form_Element_Captcha('signup',
														array('captcha' => array(
																				'captcha' => 'Figlet',
																				'wordLen' => 6,
																				'timeout' => 600
														)));
		$captchaElement->setLabel('Please type in the words below to continue');
						//->addErrorMessage('The word you have entered do not match with the picture','badCaptcha');
					   //->setErrorMessages(array('badCaptcha' => 'The word you have entered dont match'));
		
		$submit = new Zend_Form_Element_Submit('txt_register');	
		$submit->setLabel("Register");
		
		$this->addElements(array($id, $email,  $username, $password,$password_confirm, $type_user, $captchaElement, $submit));
		
    }


}

